$(function(){
	  var oBtn = new ButtonInit();
	  console.info(oBtn);
	  oBtn.bookUploadShow();
	  oBtn.bookUploadHide();
});

/**
 * 按钮事件
 */
var ButtonInit = function () {
	var oBtnInit = new Object();
	//上传界面
	oBtnInit.bookUploadShow = function () {
		$('#upload-book').on('click',function(){
			$(".upload-book-div").show();
			$(".upload-book-bg").show();
		});
    };
    
	//取消上传
	oBtnInit.bookUploadHide = function () {
		$('#book-upload-cancel').on('click',function(){
			$(".upload-book-div").hide();
			$(".upload-book-bg").hide();
		});
    };
    //上传
    oBtnInit.bookUpload = function () {
		$('#upload-book-ok').on('click',function(){
			var bookPath = $('#bookPath').val();
			var suffix = bookPath.substring(bookPath.lastIndexOf('.')+1,bookPath.length);
			if(!picture){
				$.util.alert('请选择要上传的图书，不能为空!');
				return;
			}else if(suffix != 'pdf' && suffix != 'jpg' && suffix !='gif' && suffix !='png' && suffix !='txt' && suffix !='properties' ){
				$.util.alert('目前只支持pdf/png/jpg/gif/txt/properties格式的!');
				return;
			}
			var bookDescription = $('#bookDescription').html();
			if(!bookDescription){
				$.util.alert('描述不能为空!');
				return;
			}
			document.getElementById("hideBookDiv").onsubmit();
		});
    };
	 return oBtnInit;
}


